/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * main.cpp
 * Copyright (C) xinliGG 2008 <xinliGG@gmail.com>
 * 
 * main.cpp is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * main.cpp is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#include <glibmm/thread.h>
#include <gtkmm/main.h>

#include <cstdlib>
#include <string>

#include "leafget.h"
#include "util.h"
#include "mainwindow.h"


//main_window *ptr_window;

int main ( int argc, char **argv )
{
#if defined(ENABLE_NLS)
   bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
   bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);
#endif //ENABLE_NLS
	
	gtk_set_locale ();
	if( ! Glib::thread_supported() )
	Glib::thread_init();

	Gtk::Main kit( argc, argv );

#ifdef ENABLE_DBUS
	if( ! register_service() )
	{
		send_links( argv );
		exit( EXIT_SUCCESS );
	}
#endif /* ENABLE_DBUS */

	main_window window( argv );
//	ptr_window = &window;
	
	gdk_threads_enter();
	Gtk::Main::run( window );
	gdk_threads_leave();

	exit( EXIT_SUCCESS );
}

